/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package actionListeners;

import bdcgen.controleur.Controleur;
import bdcgen.controleur.Declencheur;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import modele.CriteresRecherche;
import vue.FenetreRechercherBDC;


/**
 *
 * @author Simon
 */
public class ActionLancerRecherche implements ActionListener {

    private FenetreRechercherBDC fenetre;

    public ActionLancerRecherche(FenetreRechercherBDC fenetre) {
        this.fenetre = fenetre;
    }
    
    @Override
    public void actionPerformed(ActionEvent e) {
        
        String nomIntervenant = fenetre.getNomIntervenant().getText();
        int semaine = Integer.parseInt(fenetre.getSemaine().getText());
        String session = (String)fenetre.getSession().getSelectedItem();
        byte site = (byte)(fenetre.getSite().getSelectedIndex()+1);
        int annee = Integer.parseInt(fenetre.getAnnee().getText());
        int mois = Integer.parseInt(fenetre.getMois().getText());
        int numero = Integer.parseInt(fenetre.getNumero().getText());
        CriteresRecherche details = new CriteresRecherche(nomIntervenant,semaine,session,site,annee,mois,numero);
        
        Controleur.getInstance().lancerScenario(new Declencheur(Declencheur.RECHERCHER_BDC, details));
    }
    
    
}
